extends Node
class_name LevelData

const ROOM_PATH_PREFIX := "res://game/01_scenes/rooms/"

var level_number: int = 1
var room_index: int = 1
var is_boss_room: bool = false
var room_queue: Array = []

func validate() -> bool:
	return room_index in range(1, 7) and level_number >= 1

func reset():
	level_number = 1
	room_index = 1
	is_boss_room = false
	room_queue.clear()

func to_dict() -> Dictionary:
	return {
		"number": level_number,
		"room": room_index,
		"is_boss": is_boss_room,
		"room_queue": room_queue,
	}

func from_dict(data: Dictionary) -> void:
	level_number = data.get("number", 1)
	room_index = data.get("room", 1)
	is_boss_room = data.get("is_boss", false)
	room_queue = data.get("room_queue", [])

func _load_room_paths(room_names: Array[String]) -> Array[String]:
	return room_names.map(func(_name): return "%s%s" % [ROOM_PATH_PREFIX, _name])
